

#ifndef   _ZXREFLOCK_H
#define   _ZXREFLOCK_H

#include "zrxnames.h"
#include "zdbidar.h"
#pragma pack (push, 8)

class UcDbDatabase;
class UcDbIdMapping;
class UcDwgFileHandle;

class UcEdXrefFileLock
{
public:
     UcEdXrefFileLock();
    ~UcEdXrefFileLock();

    Ucad::ErrorStatus lockFile(
                         int& retstatus,
                         const UcDbObjectId& selectedBTRid);

    Ucad::ErrorStatus releaseFile(
                        int& retstatus,
                        bool bSkipSaveback = false,
                        bool bReload = true);

    Ucad::ErrorStatus consistencyCheck(
                         int& retstatus,
                         const UcDbObjectId& selectedBTRid,
                         UcDbObjectIdArray& outofSyncBTRids);

    Ucad::ErrorStatus consistencyCheck(
                         int& retstatus,
                         const UcDbObjectId& selectedBTRid);

    Ucad::ErrorStatus consistencyChecklocal(
                         int& retstatus,
                         const UcDbObjectId& selectedBTRid);

    Ucad::ErrorStatus xloadctlType(
                         int& retstatus,
                         const UcDbObjectId& selectedBTRid);

    int               getlockxloadctlType() const { return mXldctltype; }

    const UcDbObjectIdArray& getoutofSyncIdArray() const { return mXBTRidArray; }

    Ucad::ErrorStatus reloadFile(
                         int& retstatus,
                         const UcDbObjectIdArray& BTRids,
                         const int xldctltype = -1);

    Ucad::ErrorStatus reloadFile(
                         int& retstatus,
                         const int xldctltype = -1);

    void              setInternalTNmgmt(bool bTNmgmt);

private:
    UcDwgFileHandle*    mdwgfile;
    UcDbDatabase*       mpXDB;
    UcDbDatabase*       mpXDBlockFile;
    int                 mXldctltype;
    UcDbObjectId        mXBTRid;
    UcDbObjectIdArray   mXBTRidArray;
    bool                mbIntTNmgmt;

};

#pragma pack (pop)
#endif  
